# -*- coding: utf-8 -*-
from django.urls import path,include,re_path
from . import views
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register(r'students',views.StudentViewSet)
router.register(r'groups',views.GroupViewSet)
router.register(r'studentList',views.StudentView)

'''
 http://127.0.0.0:8000/drf/api/students/
 http://127.0.0.0:8000/drf/api/students/1/
'''

urlpatterns = [
    path('index/', views.index),
    path('api/',include(router.urls)),
    path('getJson/',views.getJson),
    path('createJson/',views.getMayJson),
    re_path(r'^updata/(?P<pk>\d+)/$',views.upData),
    re_path(r'^studet_list/',views.student_page),
    path('getData/',views.getData),
    path('getDict/',views.getDict),
    path('getList/',views.getList),
    path('artciles/',views.article_list), # 获取或创建
    path('articles_detail/<int:id>/', views.article_detail),  # 查找、更新、删除
    path('after/',views.after_list), # 一对一  获取或创建
    path('sun/',views.sun_list), # 一对一  获取或创建
    path('users/', views.user_list, name='user_list'),  # 获取或创建
    path('users/<int:id>/', views.user_detail, name='user-detail'),  # 查找、更新、删除
]

